package com.buobao.lambda;

import java.util.Arrays;
import java.util.Optional;

/**
 * stream流式编程示例
 */
public class StreamSample {
    public static void main(String[] args) {
        Optional<Integer> op = Arrays.asList(1,2,3,4,5,6).stream()
                .filter(x->x%2==0)
                .sorted((a,b)->b-a)
                .findFirst();
        System.out.println(op.get());
    }
}
